unit App.Action.TAppDefaultActionViewOpenAction;

interface

uses SmallStruct.Action,
  App.Action.TAppCustomeAction;

type
  TAppDefaultActionViewOpenAction = class(TAppCustomeAction)
  protected
    function DoPerform(ActionContext: ISSActionContext): Boolean; override;
  end;

implementation

uses SmallStruct.Configuration,
  SmallStruct.View,
  SmallStruct.Tools,
  SmallStruct.Model,
  SmallStruct.Configuration.TSSViewConfiguration;

{ TAppDefaultActionViewOpenAction }

function TAppDefaultActionViewOpenAction.DoPerform(ActionContext: ISSActionContext): Boolean;
var
  TransferData: TSSRecord;
  OpenCondition: ISSRecord;
begin
  ActionContext.GetResponseView.GetContext.GetParameter.AppendObject((ActionContext.GetRequestView.GetContext.GetConfiguration as ISSViewConfiguration).GetPrimaryModelName, GetRequestViewPrimaryDataModel.GetObjectInstance);
  TransferData := TSSRecord.Create(Self);
  if ActionContext.GetRequestView.GetContext.GetParameter.FindObject('OPEN_CONDITION') >= 0 then
  begin
    OpenCondition := ActionContext.GetRequestView.GetContext.GetParameter.GetObject('OPEN_CONDITION') as ISSRecord;
    TransferData.AppendValue('KeyName', OpenCondition.GetValue(OpenCondition.GetValueName(0)));
    //TransferData.AppendValue('Count',GetRequestViewPrimaryDataModel.GetDataSet.GetCount);
    ActionContext.GetResponseView.GetContext.GetParameter.AppendObject('TRANSFER_DATA', TransferData);
  end;
  Result := True;
end;

end.
